package com.zjdiepu.www.commpent.mapper.yw;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.status.ApplyDiviStatus;
import com.zjdiepu.www.base.enums.status.OpenCardStatus;
import com.zjdiepu.www.base.enums.status.ThirdBusiStatus;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.yw.response.YwBusinessDetail;
import com.zjdiepu.www.util.CachedEnums;
/**
 * 项目名称：dpqc-parent-manager-information <br/> 
 * 类名称：YwBusinessDetailMapper <br/>  
 * 类描述： <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月26日 下午1:33:37  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月26日 下午1:33:37   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class YwBusinessDetailMapper extends BaseMapper<YwBusinessDetail>{
	@Resource
	private RedisObjectClient redisObjectClient;

	@Override
	public void mapper(RedisConnection redisConnection,YwBusinessDetail m) {
		if(null == m) {
			return;
		}

		Integer channelStatus = m.getChannelStatus();
		SimpleDataDictionary simpleDataDictionary1 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), channelStatus != null ? channelStatus.toString() : null, DataDicType.CHANNEL_STATUS.getCode());
		m.setChannelStatusDisplay(simpleDataDictionary1 == null ? "" : simpleDataDictionary1.getName());
		
		Integer openCardStatus = m.getOpenCardStatus();
		m.setOpenCardStatusDisplay((String)CachedEnums.getValue(openCardStatus, OpenCardStatus.class));
		
		Integer applyDiviStatus = m.getApplyDiviStatus();
		m.setApplyDiviStatusDisplay((String)CachedEnums.getValue(applyDiviStatus, ApplyDiviStatus.class));
		
		String channelType = m.getChannelType();
		SimpleDataDictionary simpleDataDictionary2 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), channelType, DataDicType.CHANNEL_TYPE.getCode());
		m.setChannelTypeDisplay(simpleDataDictionary2 == null ? "" : simpleDataDictionary2.getName());
		
		String dealerLevel = m.getDealerLevel();
		SimpleDataDictionary simpleDataDictionary3 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), dealerLevel, DataDicType.DEALER_LEVEL.getCode());
		m.setDealerLevelDisplay(simpleDataDictionary3 == null ? "" : simpleDataDictionary3.getName());
		
		String loanBank = m.getLoanBank();
		SimpleDataDictionary simpleDataDictionary4 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), loanBank, DataDicType.LOAN_BANK.getCode());
		m.setLoanBankDisplay(simpleDataDictionary4 == null ? "" : simpleDataDictionary4.getName());
		
		String loanType = m.getLoanType();
		SimpleDataDictionary simpleDataDictionary5 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), loanType, DataDicType.LOAN_TYPE.getCode());
		m.setLoanTypeDisplay(simpleDataDictionary5 == null ? "" : simpleDataDictionary5.getName());
		
		String fundChannel = m.getFundChannel();
		SimpleDataDictionary simpleDataDictionary6 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), fundChannel, DataDicType.FUND_CHANNEL.getCode());
		m.setFundChannelDisplay(simpleDataDictionary6 == null ? "" : simpleDataDictionary6.getName());
		
		String busiType = m.getBusiType();
		SimpleDataDictionary simpleDataDictionary7 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), busiType, DataDicType.BUSI_TYPE.getCode());
		m.setBusiTypeDisplay(simpleDataDictionary7 == null ? "" : simpleDataDictionary7.getName());
		
		String fundToAccountStatus= m.getFundToAccountStatus();
		SimpleDataDictionary simpleDataDictionary8 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), fundToAccountStatus, DataDicType.FUNDTOACCOUNT_STATUS.getCode());
		m.setFundToAccountStatusDisplay(simpleDataDictionary8 == null ? "" : simpleDataDictionary8.getName());
		
		Integer thirdBusiStatus = m.getThirdBusiStatus();
		m.setThirdBusiStatusDisplay((String)CachedEnums.getValue(thirdBusiStatus, ThirdBusiStatus.class));
		
	}

}
